package com.czh.springboot04.service.serviceimpl;

import com.czh.springboot04.entity.Publicity;
import com.czh.springboot04.mapper.PublicityMapper;
import com.czh.springboot04.service.PublicityService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PublicityServiceImpl implements PublicityService {

    @Autowired
    private PublicityMapper publicityMapper;
    @Override
    public int publicityAdd(Publicity prublicity) {
        int i = publicityMapper.publicityAdd(prublicity);
        return i;
    }

    @Override
    public int publicityUpdate(Publicity prublicity) {
        int i = publicityMapper.publicityUpdate(prublicity);
        return i;
    }

    @Override
    public int publicityeDelete(int id) {
        int i = publicityMapper.publicityeDelete(id);
        return i;
    }

    @Override
    public PageInfo<Publicity> publicitySelectAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Publicity> list = publicityMapper.publicitySelectAll();
        PageInfo<Publicity> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
